#ifndef QTAV_QML_QQUICKRENDERER_P_H
#define QTAV_QML_QQUICKRENDERER_P_H

#include <QtAV/private/VideoRenderer_p.h>
#include <QtQuick/QSGTexture>
#include <QtQuick/QSGSimpleTextureNode>
#include <QmlAV/QQuickItemRenderer.h>

namespace QtAV
{

class QQuickItemRendererPrivate : public VideoRendererPrivate
{
public:
    QQuickItemRendererPrivate():
        VideoRendererPrivate()
      , fill_mode(QQuickItemRenderer::PreserveAspectFit)
      , texture(0)
      , node(0)
      , source(0)
    {
    }
    virtual ~QQuickItemRendererPrivate() {
        if (texture) {
            delete texture;
            texture = 0;
        }
    }
    virtual void setupQuality() {
        if (!node)
            return;
        if (quality == VideoRenderer::QualityFastest) {
            ((QSGSimpleTextureNode*)node)->setFiltering(QSGTexture::Nearest);
        } else {
            ((QSGSimpleTextureNode*)node)->setFiltering(QSGTexture::Linear);
        }
    }

    QQuickItemRenderer::FillMode fill_mode;
    QSGTexture* texture;
    QSGNode *node;
    QObject *source;
    QImage image;
};

} //namespace QtAV

#endif // QTAV_QML_QQUICKRENDERER_P_H
